package com.zbb.order.service;

import com.zbb.order.mapper.OrderDetailsMapper;
import com.zbb.order.mapper.OrderInitiateMapper;
import com.zbb.order.model.po.OrderDetails;
import com.zbb.order.model.po.OrderInitiate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
public class ThreadService {
    @Async("taskExecutor")
    public void updateOrderViewCount(OrderInitiateMapper orderInitiateMapper, String orderId) {
        OrderInitiate orderInitiate = orderInitiateMapper.selectById(orderId);
        orderInitiate.setHotness(orderInitiate.getHotness()+1);
        orderInitiateMapper.updateById(orderInitiate);
        try {
            Thread.sleep(5000);

            System.out.println("完成了");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
